﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace view
{
    public partial class ProgressBarFrm : Form
    {
        public ProgressBarFrm()
        {
            InitializeComponent();
        }

        private void ProgressBarFrm_Load(object sender, EventArgs e)
        {
            timer1.Start();
        }
        public static ProgressBarFrm _ProgressBarFrm;
        private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.Value++;
            if (progressBar1.Value == 10)
                timer1.Stop();
        }
        public static void Run()
        {
            _ProgressBarFrm = new ProgressBarFrm();
            _ProgressBarFrm.Show();
        }
        public static void CloseFrm()
        {
            if (_ProgressBarFrm != null)
            {
                _ProgressBarFrm.Stop();
                _ProgressBarFrm = null;
            }

        }
        public void Start()
        {
            Show();
            timer1.Start();
        }
        public void Stop()
        {
            timer1.Stop();
            for (int i = progressBar1.Value; i < 100; i++)
            {
                progressBar1.Value++;

            }
            Thread.Sleep(500);
            this.Hide();
            this.Close();
        }
    }
}
